package com.bjpowernode.controller;

import com.bjpowernode.domain.Student;
import com.bjpowernode.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
public class userController {
    @Autowired
    private UserService userService;

    @RequestMapping("/usercount")
    public String userCount(Model model){
        Integer count = userService.queryUserCount();
        model.addAttribute("count",count);
        return "result";

    }
    @RequestMapping("/updateUser")
    public String userCount1(Model model){
        Student student = new Student();
        student.setId(1);
        student.setName("大名121");
        student.setAge(2323);
        Integer result = userService.updaUser(student);
        model.addAttribute("result",result);
        return "result";

    }
    @GetMapping ("/restful/{name}/{age}")
    @ResponseBody
    public Object userCount2(@PathVariable("name") String namr,@PathVariable("age") Integer age){
        Student student = new Student();
        student.setId(4);
        student.setName(namr);
        student.setAge(age);
        return student;



    }
}
